n=eval(input())
arr=list()
ans=0
i=1
sum=0
while ans<n-1:
    if i==n+1:
        i=1
    if i not in arr:
        sum+=1
    if sum==3:
        arr.append(i)
        sum=0
        ans+=1
    i+=1
for i in range(1,n+1):
    if i not in arr:
        print(i)